//
//  UPVButton.m
//  LoveFreshBee
//
//  Created by wyzc on 16/6/14.
//  Copyright © 2016年 叶落知秋. All rights reserved.
//

#import "UPVButton.h"

@implementation UPVButton
-(void)layoutSubviews{
    [super layoutSubviews];
    
//    CGPoint center=self.imageView.center;
//    center.x=self.frame.size.width/2;
//    center.y=self.imageView.frame.size.height/2;
//    self.imageView.center=center;
//    
//    CGRect newFrame=[self titleLabel].frame;
//    
//    newFrame.origin.x=0;
//    newFrame.origin.y=self.imageView.frame.size.height+5;
//    newFrame.size.width=self.frame.size.width;
//    
//    self.titleLabel.frame=newFrame;
//    self.titleLabel.textAlignment=UITextAlignmentCenter;
//
    //获得imgview的最大x值
    CGFloat imgMaxX=CGRectGetMaxX(self.imageView.frame);
    //获得imagev的最大y值
    CGFloat imgMaxY=CGRectGetMaxY(self.imageView.frame);
    //设置imageview的新坐标
    self.imageView.frame=CGRectMake(imgMaxX/2, imgMaxY/2-self.imageView.frame.size.height/2+5, self.imageView.frame.size.width, self.imageView.frame.size.height);
    
    //s设置titlelabel的新坐标
    self.titleLabel.frame=CGRectMake(imgMaxX/2, imgMaxY/2+10, self.titleLabel.frame.size.width, self.titleLabel.frame.size.height);
    
}

@end
